<?php

namespace app\mini\controller\v1\client\validate;


use think\Validate;

class OrderValidate extends Validate
{
    protected $rule = [
        'shop_id'      => 'require',
        'car_id'       => 'require',
        'contact'      => 'require',
        'goods_id'     => 'require',
        'mobile'       => ['require', 'length:11', 'regex:/^1[3456789]{1}\d{9}$/'],
        'page'         => 'require',
        'order_status' => 'between:0,5',
        'order_id'     => 'require',
        'pay_type'     => 'require|between:1,3',
    ];

    protected $message = [
        'shop_id.require'       => '门店id必填',
        'car_id.require'        => '车辆未选',
        'mobile.require'        => '手机号未填',
        'mobile.length'         => '手机号格式错误',
        'mobile.regex'          => '手机号格式错误',
        'contact.require'       => '联系人未填',
        'shop_goods_id.require' => '商品未选',
        'goods_id.require' => '商品未选择',
        'order_status.between'  => '订单状态参数错误',
    ];

    protected $scene = [
        'order_confirm'             => ['shop_id', 'goods_id'],
        'submit'             => ['shop_id', 'car_id', 'mobile', 'contact', 'goods_id'],
        'index'              => ['order_status'],
        'info'               => ['order_id'],
        'cancel'             => ['order_id'],
        'applyRefund'        => ['order_id'],
        'pay'                => ['order_id', 'pay_type'],
        'calculate'          => ['shop_id', 'shop_goods_id'],
        'orderPayMethodInfo' => ['order_id'],
        'calculateByPayType' => ['order_id', 'pay_type'],
    ];
}